//
//  EquipmentQueryCell.m
//  PropertyMananger
//
//  Created by bh on 17/2/8.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "EquipmentQueryCell.h"

@implementation EquipmentQueryCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellID = @"EquipmentQueryCellID";
    EquipmentQueryCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if(cell == nil) {
        cell = [[EquipmentQueryCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    //选中cell的颜色 -无色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    return cell;
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.equipmentCodeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentCodeLabel];
        
        self.equipmentCodeLabel.textColor = BHColor(51, 51, 51);
        self.equipmentCodeLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentCodeLabel.font = BHFont(15);
        self.equipmentCodeLabel.textColor = Theme_Color;
        self.equipmentCodeLabel.text = @"设备编号：2323434343433";
      //  self.equipmentCodeLabel.backgroundColor = BHRandColor;
        
        [self.equipmentCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(self).with.offset(12.5);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 95, 25));
        }];
        
        UIImageView * arrowImg = [[UIImageView alloc]init];
        [self.contentView addSubview:arrowImg];
        arrowImg.image = IMG(@"ico_work_order_next");
        
        [arrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(self).with.offset(-15);
            make.centerY.equalTo(self.equipmentCodeLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(8, 14));
        }];
        
        UIView * lineView = [[UIView alloc]init];
        [self.contentView addSubview:lineView];
        
        lineView.backgroundColor = BHColor(230, 230, 230);
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW, 1));
            make.top.equalTo(self.equipmentCodeLabel.mas_bottom).with.offset(12.5);
        }];
        
        self.equipmentName = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentName];
        
        self.equipmentName.textColor = BHColor(102, 102, 102);
        self.equipmentName.textAlignment = NSTextAlignmentLeft;
        self.equipmentName.font = BHFont(15);
        self.equipmentName.text  = @"设备名称:";
        
        [self.equipmentName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(lineView).with.offset(15);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.equipmentNameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentNameLabel];
        
        self.equipmentNameLabel.textColor = BHColor(51, 51, 51);
        self.equipmentNameLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentNameLabel.font = BHFont(15);
        self.equipmentNameLabel.text  = @"监控摄像头";
        // self.complianManLabel.backgroundColor = BHRandColor;
        
        [self.equipmentNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.equipmentName.mas_trailing).with.offset(0);
            make.top.equalTo(self.equipmentName).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/3, 25));
        }];

        self.equipmentType = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentType];
        
        self.equipmentType.textColor = BHColor(102, 102, 102);
        self.equipmentType.textAlignment = NSTextAlignmentLeft;
        self.equipmentType.font = BHFont(15);
        self.equipmentType.text  = @"规格型号:";
        
        [self.equipmentType mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.equipmentName).with.offset(0);
            make.top.equalTo(self.equipmentName.mas_bottom).with.offset(10);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.equipmentTypeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentTypeLabel];
        
        self.equipmentTypeLabel.textColor = BHColor(51, 51, 51);
        self.equipmentTypeLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentTypeLabel.font = BHFont(15);
        self.equipmentTypeLabel.text  = @"WFH-455454";
        //   self.timeLabel.backgroundColor = BHRandColor;
        
        [self.equipmentTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.equipmentType.mas_trailing).with.offset(0);
            make.top.equalTo(self.equipmentType).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/2+50, 25));
        }];
        
        self.equipmentStatus = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentStatus];
        
        self.equipmentStatus.textColor = BHColor(102, 102, 102);
        self.equipmentStatus.textAlignment = NSTextAlignmentLeft;
        self.equipmentStatus.font = BHFont(15);
        self.equipmentStatus.text  = @"设备状态:";
        
        [self.equipmentStatus mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.equipmentType).with.offset(0);
            make.top.equalTo(self.equipmentType.mas_bottom).with.offset(10);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.equipmentStatusLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentStatusLabel];
        
        self.equipmentStatusLabel.textColor = BHColor(51, 51, 51);
        self.equipmentStatusLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentStatusLabel.font = BHFont(15);
        self.equipmentStatusLabel.textColor = [UIColor redColor];
        self.equipmentStatusLabel.text  = @"在用";
        
        [self.equipmentStatusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.leading.equalTo(self.equipmentStatus.mas_trailing).with.offset(0);
            make.centerY.equalTo(self.equipmentStatus).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/3, 50));
        }];

        self.equipmentInstall = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentInstall];
        
        self.equipmentInstall.textColor = BHColor(102, 102, 102);
        self.equipmentInstall.textAlignment = NSTextAlignmentLeft;
        self.equipmentInstall.font = BHFont(15);
        self.equipmentInstall.text  = @"安装地址:";
        
        [self.equipmentInstall mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.equipmentStatus).with.offset(0);
            make.top.equalTo(self.equipmentStatus.mas_bottom).with.offset(10);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.equipmentInstallLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.equipmentInstallLabel];
        
        self.equipmentInstallLabel.textColor = BHColor(51, 51, 51);
        self.equipmentInstallLabel.textAlignment = NSTextAlignmentLeft;
        self.equipmentInstallLabel.font = BHFont(15);
        self.equipmentInstallLabel.numberOfLines = 3;
        self.equipmentInstallLabel.text  = @"1栋3单元6层楼梯间1栋3单元6层楼梯间1栋3单元6层楼梯间1栋3单元6层楼梯间1栋3单元6层楼梯间";
        
        [self.equipmentInstallLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.leading.equalTo(self.equipmentInstall.mas_trailing).with.offset(0);
            make.centerY.equalTo(self.equipmentInstall).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 100, 25));
        }];
        
    }
    return self;
}
@end
